{{extend "base.html"}}

{{block head}}
<style type="text/css">
	body {
		margin-left: 0px;
		margin-top: 0px;
		margin-right: 0px;
		margin-bottom: 0px;
	}

	.jgtable {
		border-top-width: 0px;
		border-right-width: 0px;
		border-bottom-width: 1px;
		border-left-width: 0px;
		border-bottom-style: solid;
		border-bottom-color: #999999;
		veritical-align: bottom;
	}
	.jgtitle {
		color: #ffffff;
		font-weight: bold;
	}
	.big_title {color: #FFFFFF;font-size:13px;}

</style>
<script>
	var tree;
	var mainMenu;
	var mainTabs;
	$(function() {
		mainMenu = $('#mainMenu').tree({
			url : '/idcpost/computerroomtreegraph',
			parentField : 'pid',
			onClick : function(node) {
				if (node.attributes.url) {
					var src = node.attributes.url;
					if (!sy.startWith(node.attributes.url, '/')) {
						src = node.attributes.url;
					}
					if (node.attributes.target && node.attributes.target.length > 0) {
						window.open(src, node.attributes.target);
					} else {
						var tabs = $('#mainTabs');
						var opts = {
							title : node.text,
							closable : true,
							iconCls : node.iconCls,
							content : sy.formatString('<iframe src="{0}" allowTransparency="true" style="border:0;width:100%;height:99%;" frameBorder="0"></iframe>', src),
							border : false,
							fit : true
						};
						if (tabs.tabs('exists', opts.title)) {
							tabs.tabs('select', opts.title);
						} else {
							tabs.tabs('add', opts);
						}
					}
				}
			}
		});
		
		$('#mainLayout').layout('panel', 'center').panel({
			onResize : function(width, height) {
				sy.setIframeHeight('centerIframe', $('#mainLayout').layout('panel', 'center').panel('options').height - 5);
			}
		});
		
		mainTabs = $('#mainTabs').tabs({
			fit : true,
			border : false,
			tools : [ {
				text : '刷新',
				iconCls : 'ext-icon-arrow_refresh',
				handler : function() {
					var panel = mainTabs.tabs('getSelected').panel('panel');
					var frame = panel.find('iframe');
					try {
						if (frame.length > 0) {
							for (var i = 0; i < frame.length; i++) {
								frame[i].contentWindow.document.write('');
								frame[i].contentWindow.close();
								frame[i].src = frame[i].src;
							}
							if (navigator.userAgent.indexOf("MSIE") > 0) {// IE特有回收内存方法
								try {
									CollectGarbage();
									} catch (e) {
								}
							}
						}
						} catch (e) {
					}
				}
				}, {
				text : '关闭',
				iconCls : 'ext-icon-cross',
				handler : function() {
					var index = mainTabs.tabs('getTabIndex', mainTabs.tabs('getSelected'));
					var tab = mainTabs.tabs('getTab', index);
					if (tab.panel('options').closable) {
						mainTabs.tabs('close', index);
					} else {
						$.messager.alert('提示', '[' + tab.panel('options').title + ']不可以被关闭！', 'error');
					}
				}
			} ]
		});
	});
	
</script>
{{end}}

{{block bodyclass}}
<!--body class="easyui-layout" data-options="fit:true"-->
<body id="mainLayout" class="easyui-layout">
{{end}}

{{block content}}
	
		
		<div data-options="region:'west',href:'',split:true" title="导航" style="width: 200px; padding: 10px;">
			<ul id="mainMenu"></ul>
		</div>
		<div data-options="region:'center'" style="overflow: hidden;">
			<div id="mainTabs">
				<div title="拓扑图" data-options="iconCls:'ext-icon-heart'">
					<iframe src="/portal/readme" allowTransparency="true" style="border: 0; width: 100%; height: 99%;" frameBorder="0"></iframe>
				</div>
			</div>
		</div>
{{end}}